﻿using System;
using System.Linq;
using TeamCityMonitor.Models;

namespace TeamCityMonitor.Repository
{
    public interface IHeroStoryRepository
    {
        HeroStory GetAStory();
    }

    public class HeroStoryRepository : IHeroStoryRepository
    {
        private StorageContext db = new StorageContext();

        public HeroStory GetAStory()
        {
            var stories = db.HeroStories.ToList();

            stories = stories.OrderBy(story => Guid.NewGuid()).ToList();

            return stories.First();
        }
    }
}